const router = require('koa-router')();
const DepartmentController = require('./../controllers/manager/department');
const DeController = require('./../controllers/manager/de');
const EntityController = require('./../controllers/manager/entity');
const CompanyController = require('./../controllers/manager/company');

router
    .get('/', async (ctx) => {
        await ctx.render('manager/entity/list')  // 這個配置在menu-left.ejs中的<href>值
    })

    //----------------------------------------//
    .get('/department', async (ctx) => {
        await ctx.render('manager/department/list')
    })
    .get('/department/list', DepartmentController.list)
    .post('/department/add', DepartmentController.add)
    .post('/department/update', DepartmentController.update)
    .post('/department/del', DepartmentController.del)

    .get('/company', async (ctx) => {
        await ctx.render('manager/company/list')
    })
    .get('/company/list', CompanyController.list)
    .post('/company/add', CompanyController.add)
    .post('/company/update', CompanyController.update)

    .get('/entity', async (ctx) => {
        await ctx.render('manager/entity/list')
    })
    .get('/entity/list', EntityController.list)
    .post('/entity/add', EntityController.add)
    .post('/entity/update', EntityController.update)

//----------------------------------------//

module.exports = router;